#ifndef SRS_APP_CODE_DELAY_HPP
#define SRS_APP_CODE_DELAY_HPP

#include <string>
#include <map>
#include <stdint.h>
#include <sstream>
//#include <srs_kernel_rtu_log.hpp>

class RtuCodeDelay
{
public:
    /**
     * @brief info
     * first should be the timestamp,
     * second should be the readable info.
     */
    std::map<int64_t, std::string> info;
public:
    RtuCodeDelay() {}
    virtual ~RtuCodeDelay() {}
public:
    virtual void print()
    {
        std::map<int64_t, std::string>::iterator it = info.begin();
        std::stringstream text;

        for(; it != info.end(); ++it) {
            text
            << it->second << " : " << it->first << '\n';
        }

        // delay time from start to end
        int64_t begin = info.begin()->first;
        int64_t end = info.rbegin()->first;
        int64_t duration = end - begin;

        text<< "total code delay : " <<	duration << '\n';

//        rtu_trace("%s", text.str().c_str());
    }
};

#endif // SRS_APP_CODE_DELAY_HPP
